package com.iris.egrant.app.dao.formInit;

import com.iris.egrant.exception.DaoException;
import com.iris.egrant.exception.ServiceException;
import com.iris.egrant.model.formInit.FormBaseLibrary;
import com.iris.egrant.model.formInit.FormInitItem;
import com.iris.egrant.orm.hibernate.HibernateDao;
import com.iris.egrant.app.utils.IrisStringUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.hibernate.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

@Transactional
@Repository
public class FormBaseLibraryDao
  extends HibernateDao<FormBaseLibrary, Long>
{
    /*     */
    public FormBaseLibrary getFormBaseLibraryByFormId(Long formId) throws DaoException {
        /*  35 */
        String sql = "from FormBaseLibrary t where  t.formId=? and t.status='1'";
        /*  36 */
        return (FormBaseLibrary) findUnique(sql, new Object[]{formId});
        /*     */
    }
      public List<Map<String, Object>> getRefreshList(String sqlcontent, List<Object> params) {
        /*  97 */     List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
        /*  98 */     list = queryForList(sqlcontent, params.toArray());
        /*     */
        /*     */
        /* 101 */     return list;
          }
      public FormBaseLibrary getFormBaseLibraryByFormCode(Long formCode) throws DaoException {
        /*  47 */     String sql = "from FormBaseLibrary t where  t.formCode=?";
        /*  48 */     return (FormBaseLibrary)findUnique(sql, new Object[] { formCode });
          }
      public List<FormInitItem> getFormInitItemListById(String formItems) throws DaoException, ServiceException {
        /*  60 */     String sql = "select t from FormInitItem t where  t.itemCode in ( :formitems ) order by t.seqNo";
        /*  61 */     List<Long> formitems = IrisStringUtils.getSplitLong(formItems);
        /*  62 */     Query query = getSession().createQuery(sql);
        /*  63 */     query.setParameterList("formitems", formitems);
        /*     */
        /*  65 */     List<FormInitItem> result = query.list();
        /*  66 */     return result;
          }


}